package com.rjj.wlqq.pdf;

import java.lang.reflect.Proxy;

/**
 *  return Proxy.newProxyInstance(target.getClass().getClassLoader(),
 *                target.getClass().getSuperclass().getInterfaces(),
 *                new InvocationHandler() {
 *                    @Override
 *                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
 *                            Object invoke = method.invoke(target, args);
 *                            return invoke;
 *                    }
 *                });
 * @param <T>
 */
public class PDFProxy<T> {
    private T target;

    PDFProxy(T target){
        this.target = target;
    }

    /**
     *   target.getClass().getSuperclass().getInterfaces()这个输出pdf的方法在父类中
     * @return
     */
    public Object getInstance(){
       return Proxy.newProxyInstance(target.getClass().getClassLoader(),
               target.getClass().getSuperclass().getInterfaces(),
               (proxy, method, args) -> method.invoke(target, args));
    }
}
